📕 subnode [[@KGBicheno/python proper python project preparation]]
in 📚 node [[python-proper-python-project-preparation]]
How to create a Python package
Step 1: Create a virtual environment
Linux (Debian/Apt)
- Make sure everything is up-to-date.
sudo apt-get update
followed bysudo apt-get upgrade -y
- Check you have Python installed.
python --version
(3.7 or 3.8) or fuck up, type-v
instead of--version
and blast your command line - Create the folder structure for your project. Folder structure should have the venv adjacent to the project folder. Make sure the folder where the code will live has an
__init__.py
file. This will make it a [[Python package]].
Project
|---project
| |---src
| | |---__init__.py
| | |---main.py
| |---whatevs
| |---README.md
| |---LICENCE.md
| |---.env
| |---whatevs
|---venv
|---bin
|---activate
- Create the virtual environment so that the folder structure appears as above in step 3 using
python3 -m venv venv
although the second venv can just be whatever path to the virtual environment you wish - Activate the virtual environment with
. venv\bin\activate
- Upgrade Pip with
pip install --upgrade pip
- Install/upgrade setuptools and wheel with
pip install --upgrade setuptools wheel
- Begin coding and don't forget to [[write test units!]].
Windows
- Create a file system as above
Logging
- docs.python.org: python 3 logging
📖 stoas
- public document at doc.anagora.org/python-proper-python-project-preparation
- video call at meet.jit.si/python-proper-python-project-preparation